package cn.itcast.day03;

import java.util.ArrayList;

public class Demo02ArrayListStudent {
    public static void main(String[] args) {
        student stu1 = new student("duhao",18);
        student stu2 = new student("zhanghongzhu",19);
        student stu3 = new student("duyusen",16);
        student stu4 = new student("dubin",17);

        ArrayList<student> list = new ArrayList<>();

        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        list.add(stu4);

        for (int i = 0; i < list.size(); i++) {
            student stu = list.get(i);
            System.out.println("姓名：" + stu.getName() + "年龄" + stu.getAge());
        }
    }


}
